Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
A client-side library to make absolutely positioned elements attach to elements in the page efficiently.
The 'tether' npm package is a JavaScript library for efficiently positioning elements on a web page. It allows you to attach elements to other elements, ensuring that they stay in the correct position even when the page is scrolled or resized.
Basic Tethering
This feature allows you to attach an element (e.g., a tooltip) to another element (e.g., a button). The 'attachment' and 'targetAttachment' properties define how the elements are positioned relative to each other.
const Tether = require('tether');
const tether = new Tether({
element: document.querySelector('#tooltip'),
target: document.querySelector('#button'),
attachment: 'top left',
targetAttachment: 'bottom left'
});
Constraints
This feature allows you to add constraints to the tethered element, ensuring it stays within the bounds of a specified container (e.g., the window). The 'constraints' property takes an array of constraint objects.
const Tether = require('tether');
const tether = new Tether({
element: document.querySelector('#tooltip'),
target: document.querySelector('#button'),
attachment: 'top left',
targetAttachment: 'bottom left',
constraints: [{
to: 'window',
attachment: 'together'
}]
});
Offset
This feature allows you to specify an offset for the tethered element. The 'offset' property takes a string with the horizontal and vertical offsets.
const Tether = require('tether');
const tether = new Tether({
element: document.querySelector('#tooltip'),
target: document.querySelector('#button'),
attachment: 'top left',
targetAttachment: 'bottom left',
offset: '10px 20px'
});
Popper.js is a library used to manage poppers in web applications. It provides more advanced positioning capabilities compared to Tether, including support for flipping, boundaries, and more complex positioning strategies.
Position.js is a lightweight library for positioning elements relative to other elements. It offers basic positioning functionalities similar to Tether but with a simpler API and fewer features.
Floating UI is a library for creating floating elements such as tooltips, popovers, and dropdowns. It offers a comprehensive set of features for positioning and managing floating elements, making it a more feature-rich alternative to Tether.
Tether is a JavaScript library for efficiently making an absolutely positioned element stay next to another element on the page.
It aims to be the canonical implementation of this type of positioning, such that you can build products, not positioning libraries.
Take a look at the documentation for a more detailed explanation of why you should star it now to remember it for your next project.
FAQs
A client-side library to make absolutely positioned elements attach to elements in the page efficiently.
The npm package tether receives a total of 200,101 weekly downloads. As such, tether popularity was classified as popular.
We found that tether demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.